<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/4/5
  Time: 20:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isErrorPage="true" %>
<%
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");

    if("POST".equals(request.getMethod())){
        Cookie usernameCookie = new Cookie("username",request.getParameter("username"));
        Cookie visitTimesCookie = new Cookie("visitTimes","0");
        response.addCookie(usernameCookie);
        response.addCookie(visitTimesCookie);
        response.sendRedirect(request.getContextPath()+"/cookieTest.jsp");
        return;
    }
%>
<html>
<head>
    <meta charset="utf-8;text/html">
    <title>Login In</title>
</head>
<body>
<body>
<div align="center" style="margin: 0 auto;">
    <fieldset>
        <legend>登录</legend>
        <form action="CookieLogin.jsp" method="post">
            <table>
                <tr>
                    <td></td>
                    <%--<td><span style="color: red;"><%=exception.getMessage() %></span></td>--%>
                </tr>
                <tr>
                    <td>账号:</td>
                    <td><input type="text" name="username" style="width: 160px"/></td>
                </tr>
                <tr>
                    <td>密码:</td>
                    <td><input type="password" name="password" style="width: 160px;"/></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="submit" value="Login In"/></td>
                </tr>
            </table>
        </form>
    </fieldset>
</div>
</body>
</body>
</html>
